//
//  SN_VIPConfigCell.m
//  Shiyun_Newspaper
//
//  Created by Sylar on 2017/7/3.
//  Copyright © 2017年 ShiYun. All rights reserved.
//

#import "SN_VIPConfigCell.h"

@implementation SN_VIPConfigCell
{
    UILabel *title;
    UIButton *rightBtn;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self layoutCell];
    }
    return self;
}

- (void)layoutCell {
    
    title = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, 200, 46)];
    [title setFont:[UIFont systemFontOfSize:16]];
    [title setTextColor:colorFromHex(@"3b3b3b")];
    
    [self.contentView addSubview:title];
    
    rightBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [rightBtn setFrame:CGRectMake(SCREENWIDTH - 73, 9, 58, 28)];
    [rightBtn.titleLabel setFont:[UIFont systemFontOfSize:14]];
    [rightBtn setTitleColor:colorFromHex(@"fb524a") forState:(UIControlStateNormal)];
    rightBtn.layer.cornerRadius = 14;
    rightBtn.layer.borderColor = [colorFromHex(@"fb524a") CGColor];
    rightBtn.layer.borderWidth = 1;
    rightBtn.userInteractionEnabled = NO;
    
    [self.contentView addSubview:rightBtn];
    
    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(15, 41.5, SCREENWIDTH, 0.5)];
    [line setBackgroundColor:colorFromHex(@"DEDEDE")];
    line.tag = 100;
    [self.contentView addSubview:line];
}

- (void)creatCell:(NSDictionary *)dict isVip:(NSInteger)isVip{
    
    title.text = [dict objectForKey:@"vipcentername"];
    [rightBtn setTitle:isVip == 2?@"开通":@"续费" forState:(UIControlStateNormal)];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
